package model;

import java.io.File;

/**
 * Class that handles manuscript object and
 * all associated fields.
 * @author Kevin Anderson, Jeff Kuhlman
 */
public class Manuscript extends Paper {

	/**
	 * The ID of the manusrcipt.
	 */
	private int my_id;
	
	/**
	 * The ID of the author.
	 */
	private int my_authorID;
	
	/**
	 * The Status of the Manuscript.
	 */
	private Status my_status;
	
	/**
	 * The Conference associated with the Manuscript.
	 */
	private int my_conferenceID;
	
	/**
	 * The user provided title of the manuscript.
	 */
	private String my_title;
	
	/**
	 * The abstract of the manuscript.
	 */
	private String my_abstract;
	
	/**
	 * The local file path of the manuscript.
	 */
	private String my_path;
	
	/**
	 * The SPC associated with the manuscript.
	 */
	private int my_spc;
	
	/**
	 * Creates a new manuscript.  To ensure full usage, use <link>makeFile()</link> after instantiation to ensure
	 * the file is used approprately.  If a NEW paper is being created through the UI please use {@link FileParser}<code>.NEW_ELEMENT</code> 
	 * as the_paperID to ensure a new record is written.
	 * @param the_paperID The ID associated with the paper in the datafile.
	 * @param the_author The Author of the Paper.
	 * @param the_status The Status of the Paper.
	 * @param the_conf The Conference for which the paper was submitted.
	 * @param the_title The Title of the paper.
	 * @param the_abstract The Abstracdt of the paper.
	 * @param the_path The location of the paper on the hard drive.
	 */
	public Manuscript(int the_paperID, int the_authorID, Status the_status, int the_confID, String the_title,
					  String the_abstract, String the_path, int the_spc) {
		
		super();
		my_id = the_paperID;
		my_authorID = the_authorID;
		my_status = the_status;
		my_conferenceID = the_confID;
		my_title = the_title;
		my_abstract = the_abstract;
		my_path = the_path;
		my_spc = the_spc;
		
		//not the best design, but for now let's do this...
		makeFile();
	}
	
	/**
	 * Call after instantiation to ensure the file is created.
	 * @return Will return <code>true</code> if file is created successfully, <code>false</code> otherwise.
	 */
	public boolean makeFile()
	{
		my_file = new File(my_path);
		if (my_file == null)
			return false;	
		
		return true;
	}

	/**
	 * @return the my_id
	 */
	public int getMy_id() {
		return my_id;
	}

	/**
	 * @return the my_author
	 */
	public int getMy_author() {
		return my_authorID;
	}

	/**
	 * @return the my_status
	 */
	public Status getMy_status() {
		return my_status;
	}

	/**
	 * @return the my_conference
	 */
	public int getMy_conference() {
		return my_conferenceID;
	}

	/**
	 * @return the my_title
	 */
	public String getMy_title() {
		return my_title;
	}

	/**
	 * @return the my_abstract
	 */
	public String getMy_abstract() {
		return my_abstract;
	}

	/**
	 * @return the my_path
	 */
	public String getMy_path() {
		return my_path;
	}

	/**
	 * @return the my_spc
	 */
	public int getMy_spc() {
		return my_spc;
	}
	
	/**
	 * sets the my_status
	 * @param the_status The value to be used when setting status.
	 */
	public void setMy_status(final Status the_status) {
		my_status = the_status;
	}
	
	/**
	 * sets the my_spc
	 * @param the_spc The value to be used when setting the SPC
	 */
	public void setMy_SPC(final int the_spc) {
		my_spc = the_spc;
	}
}